<template>
	<div class="LedtContent">
		<div class="form-view">
			<!-- 搜索 -->
			<div class="form-row">
				<div class="form-row-label seach">
					<i class="el-icon-search" @click="ctgVauleSearch"></i>
				</div>
				<div class="form-row-right-content">
					<el-input v-model="ctgVaule" placeholder="" class="form-ipt"
						:disabled="!$store.state.btn_set_BHView2 || !isShowDmgBtn || !isLineNo || !isSysIntelligenceList"
						@keyup.enter.native="ctgVauleSearch"></el-input>
				</div>
			</div>
			<!-- checkbox -->
			<div class="form-checkbox">
				<el-radio :disabled="!isShowDmgBtn || !isLineNo || !isSysIntelligenceList" v-model="radio" label="1"
					@change="radioChange('1')">{{
						$t("message.bhView.leftComponents.machine") }}</el-radio>
				<el-radio :disabled="!isShowDmgBtn || !isLineNo || !isSysIntelligenceList" v-model="radio" label="2"
					@change="radioChange('2')">{{
						$t("message.bhView.leftComponents.piping") }}</el-radio>
			</div>
			<!-- 装置 -->
			<div class="form-row">
				<div class="form-row-label"
					:style="{ 'opacity': !isShowDmgBtn || !isLineNo || !isSysIntelligenceList || !$store.state.btn_set_BHView2 ? '.5' : '' }">
					{{ $t("message.bhView.leftComponents.device") }}
				</div>
				<div class="form-row-right-content">
					<el-select v-model="valuePlant" :placeholder="$t('message.bhView.label.placeholderSearch')
						" class="form-ipt" @change="PlantChange()" @focus="getPlantApi(1, 1000)"
						:disabled="!$store.state.btn_set_BHView2">
						<el-option v-for="item in plantOptions" :key="item.pltCode" :label="item.pltName"
							:value="item.pltCode"></el-option>
					</el-select>
				</div>
			</div>
			<!-- 机种 -->
			<div class="form-row">
				<div class="form-row-label"
					:style="{ 'opacity': !isShowDmgBtn || !isLineNo || !isSysIntelligenceList || !$store.state.btn_set_BHView2 ? '.5' : '' }">
					{{ $t("message.bhView.leftComponents.typeOfMachine") }}
				</div>
				<div class="form-row-right-content">
					<el-select
						:disabled="!isShowDmgBtn || !isLineNo || !isSysIntelligenceList || !$store.state.btn_set_BHView2"
						v-model="valueCodeCtg" :placeholder="$t('message.bhView.label.placeholderSearch')
							" class="form-ipt" @change="CodeCtgChange()" @focus="
								getCodeCtgApi(
									0,
									'',
									1,
									100,
									radio == '1' ? '0' : '1'
								)
								">
						<el-option v-for="item in CodeCtg" :key="item.key" :label="item.label"
							:value="item.key"></el-option>
					</el-select>
				</div>
			</div>
			<!-- 法规 -->
			<div class="form-row">
				<div class="form-row-label"
					:style="{ 'opacity': !isShowDmgBtn || !isLineNo || !isSysIntelligenceList || !$store.state.btn_set_BHView2 ? '.5' : '' }">
					{{ $t("message.bhView.leftComponents.statute") }}
				</div>
				<div class="form-row-right-content">
					<el-select
						:disabled="!isShowDmgBtn || !isLineNo || !isSysIntelligenceList || !$store.state.btn_set_BHView2"
						v-model="valueCodeLaw" :placeholder="$t('message.bhView.label.placeholderSearch')
							" class="form-ipt" @change="CodeLawChange()" @focus="
								gtCodeLawApi(
									0,
									'',
									1,
									1000,
									valuePlant,
									parseInt(radio),
									valueCodeCtg
								)
								">
						<el-option v-for="item in CodeLaw" :key="item.key" :label="item.label"
							:value="item.key"></el-option>
					</el-select>
				</div>
			</div>
			<!-- clear -->
			<div class="form-row" style="margin: 0">
				<div class="form-row-label"></div>
				<div class="form-row-right-content">
					<el-button class="ClearBtn" type="primary" @click="ClearVaule" style="position: relative;"
						:class="!$store.state.btn_set_BHView2 ? 'mask' : ''">Clear</el-button>
				</div>
			</div>
		</div>

		<!-- 机器番号 -->
		<div class="machine-number-long machine-number" style="position: relative;"
			:class="!$store.state.btn_set_BHView2 ? 'mask' : ''">
			<!-- <div class="title">
				<span v-if="radio == '1'">{{
					$t("message.bhView.leftComponents.MachineSerialNumber")
				}}</span>
				<span v-if="radio == '2'">{{
					$t("message.bhView.leftComponents.PeiGuanNumber")
				}}</span>
			</div>
			<div class="machine-number-body">
				<div
					class="Item"
					v-for="(Item, index) in drwMgtData"
					:key="Item.dmgCode"
					@click="ClickTableRow(Item, index)"
					:class="index == itemActive ? 'ItemActive' : ''"
				>
					<div class="ItemID">{{ index + 1 }}</div>
					<div class="ItemName">
						{{ Item.macName }}
					</div>
				</div>
			</div> -->

			<ux-grid ref="multipleTable"
				:data="!isShowDmgBtn ? processor : !isLineNo ? lineNoList : !isSysIntelligenceList ? SysIntelligenceList : drwMgtData"
				style="width: 100%" :header-cell-style="{
					color: 'rgb(0, 0, 0)',
					fontSize: '14px',
					textAlign: 'center',
					fontWeight: '500',
					padding: 0,
					height: '32px',
					background: 'rgba(233, 233, 233, 1)',

				}" :cell-style="{
					color: 'rgba(96,98,102,1)',
					fontSize: '14px',
					padding: 0,
					height: '23px',
					margin: '0'
				}" :row-style="{
					color: 'rgba(96,98,102,1)',
					fontSize: '13px',
					textAlign: 'left',
					padding: 0,
					height: '23px',
				}" @selection-change="handleSelectionChange" :height="tableHeight"
				:element-loading-text="$t('message.bhView.loading')">
				<template slot="empty"> No data </template>
				<ux-table-column property="partsCode" width="47" type="index" align="center">
					<!-- <template slot-scope="scope">
						<p style="text-align:center;">{{ index }}</p>
					</template> -->
				</ux-table-column>

				<ux-table-column property="macName" :title="!isShowDmgBtn ? '処理系一覧' : !isLineNo ? 'ラインNo' : (!isSysIntelligenceList ? '系統番号' : (radio == '1'
					? $t('message.bhView.leftComponents.MachineSerialNumber')
					: $t('message.bhView.leftComponents.PeiGuanNumber')))">
					">
					<template slot-scope="scope">
						<!-- <p>{{ !isShowDmgBtn ? scope.row.proName : scope.row.macName }}</p> -->
						<el-tooltip class="item" effect="dark"
							:content="!isShowDmgBtn ? scope.row.proName : (!isSysIntelligenceList ? scope.row.codName : scope.row.macName)"
							placement="top">
							<span style="white-space: nowrap;">{{ !isShowDmgBtn ? scope.row.proName :
								(!isSysIntelligenceList ? scope.row.codName : scope.row.macName)
								}}</span>
						</el-tooltip>
					</template>
				</ux-table-column>

				<ux-table-column type="checkbox" width="37" align="center"> </ux-table-column>
			</ux-grid>
		</div>

		<!-- 底部信息 -->
		<div class="bh-footer">
			<div class="bh-footer-msg">
				{{ $t("message.bhView.WallThicknessPattern.number") }}
				{{ !isShowDmgBtn ? processor.length : (!isLineNo ? lineNoList.length : (!isSysIntelligenceList ?
					SysIntelligenceList.length : drwMgtData.length)) }}
				{{ $t("message.bhView.WallThicknessPattern.piece") }}
			</div>
			<div class="bh-footer-msg">
				<span>{{
					$t("message.bhView.WallThicknessPattern.select")
				}}</span>
				{{ checkboxSelectedList.length }}
				{{ $t("message.bhView.WallThicknessPattern.piece") }}
			</div>
		</div>
	</div>
</template>

<script>
import { getPlant, getMachine, gtCodeLaw, getCodeCtg, getProcessor, GetMachineByCod, GetLineIndexMacCode, GetSysIntelligenceList } from "@/api/api";
import eventBus from "@/eventBus/bus";
import $ from "jquery";
import { getLocalStorage } from "@/utils/storage";
import { showLoading, hideLoading } from "@/utils/loading";
// 导出模块
export default {
	// 模块名字
	name: "LeftContent",
	props: {
		styleOptionsValue: Number,
		isShowDmgBtn: Boolean,
		isLineNo: Boolean,
		isSysIntelligenceList: Boolean,
		clearSelect: Number,
	},
	// 模块数据
	data() {
		//数据
		return {
			input: "",
			radio: this.$store.state.macType.toString(),
			options: [
				{
					value: "",
					label: "",
				},
			],
			value: "",
			plantOptions: [],
			valuePlant: "",
			drwMgtData: [],
			CodeLaw: [],
			valueCodeLaw: "",
			CodeCtg: [],
			valueCodeCtg: "",
			number: 0,
			itemActive: null,
			ReaditemActive: null,
			ctgVaule: "",
			selectViewValue: 1,

			tableHeight: 0,

			checkboxSelectedList: [],
			processor: [],
			lineNoList: [],
			SysIntelligenceList: [],
		};
	},
	// 注册组件
	components: {},
	// 监听指定值，只有指定值变化，才会触发
	watch: {
		isShowDmgBtn(v) {
			console.log(v, 'VVVVVVVVVVV')
			if (!v) {
				console.log(this.drwMgtData)
				this.getProcessorApi();
			} else {
				if (this.isShowDmgBtn && this.isLineNo && this.isSysIntelligenceList) {
					//this.ClearVaule();
				}
			}
		},

		isLineNo(v) {
			console.log(v, 'LLLLLL')
			if (!v) {
				this.radio = '2';
				this.$store.state.macType = 2;
				console.log(this.drwMgtData)
				this.GetLineIndexMacCodeApi();
			} else {
				this.radio = '1';
				this.$store.state.macType = 1;
				this.ClearVaule();
			}
		},

		isSysIntelligenceList(v) {
			console.log(v, 'SSSSSS')
			if (!v) {
				this.radio = '2';
				this.$store.state.macType = 2;
				console.log(this.drwMgtData)
				this.GetSysIntelligenceListApi();
			} else {
				if (this.isShowDmgBtn && this.isLineNo && this.isSysIntelligenceList) {
					//this.ClearVaule();
				}
			}
		},

		clearSelect(v) {
			this.ClearVaule();
		}
	},
	// 里面的函数只有调用才会执行（实时计算）里面是定义的方法
	methods: {
		//获取lineNo
		GetLineIndexMacCodeApi() {
			// !isLineNo
			this.lineNoList = [];
			let dataJson = {
				pltCode:
					this.$store.state.pltCode == "" ? 0 : this.$store.state.pltCode,
			};
			GetLineIndexMacCode(dataJson).then((res) => {
				if (res.data.code != 0 && res.data.code != -300) {
					this.$message({
						type: 'error',
						message: res.data.msg
					})
					return;
				}
				this.lineNoList = res.data.data;
			});
		},

		//評価グラフ
		GetSysIntelligenceListApi() {
			this.SysIntelligenceList = [];
			let dataJson = {
				MacType: 2,
				pltCode:
					this.$store.state.pltCode == "" ? 0 : this.$store.state.pltCode,
			};
			GetSysIntelligenceList(dataJson).then((res) => {
				if (res.data.code != 0 && res.data.code != -300) {
					this.$message({
						type: 'error',
						message: res.data.msg
					})
					return;
				}
				this.SysIntelligenceList = res.data.data;
				console.log(this.SysIntelligenceList);
			});
		},

		//获取处理器
		getProcessorApi() {
			this.processor = [];
			let dataJson = {
				pltCode:
					this.$store.state.pltCode == "" ? 0 : this.$store.state.pltCode,
			};
			getProcessor(dataJson).then((res) => {
				if (res.data.code != 0 && res.data.code != -300) {
					this.$message({
						type: 'error',
						message: res.data.msg
					})
					return;
				}
				this.processor = res.data.data;
			});
		},
		// 获取装置
		getPlantApi(pageIndex, pageSize) {
			let dataJson = {
				pltCode: 0,
				platName: "",
				pageIndex: pageIndex,
				pageSize: pageSize,
			};
			getPlant(dataJson).then((res) => {
				this.plantOptions = [];
				if (res.data.code != 0) {
					return;
				}
				this.plantOptions = res.data.data;
			});
		},
		//获取机器/配管
		getMachineApi(macCode, macName, impCode, pageIndex, pageSize) {
			showLoading();
			let dataJson = {
				macCode: macCode == "" ? 0 : macCode,
				macName: macName,
				pltCode:
					this.$store.state.pltCode == ""
						? 0
						: this.$store.state.pltCode,
				macType: this.$store.state.macType,
				ctgCode:
					this.$store.state.ctgCode == ""
						? 0
						: this.$store.state.ctgCode,
				impCode: impCode == "" ? 0 : impCode,
				lawCode:
					this.$store.state.lawCode == ""
						? 0
						: this.$store.state.lawCode,
				pageIndex: pageIndex,
				pageSize: 9999,
			};
			getMachine(dataJson).then((res) => {
				hideLoading();
				this.drwMgtData = [];
				this.checkboxSelectedList = [];
				eventBus.$emit("reportformLeftMacSelect", []);
				this.number = 0;
				this.$emit("ClearDataFunction");
				if (res.data.code != 0) {
					this.$emit("ClickTableRow", {});
					return;
				}
				this.drwMgtData = res.data.data;
				this.number = res.data.count;
				this.itemActive = 0;
				// if (this.drwMgtData.length == 0) {
				//   return;
				// }
				this.$emit("ClickTableRow", this.drwMgtData[0]);
				this.$emit("clearBhTabel");
			});
		},

		//获取法规
		gtCodeLawApi(
			code,
			codName,
			pageIndex,
			pageSize,
			pltCode,
			macType,
			ctgCode
		) {
			let dataJson = {
				code: code,
				codName: codName,
				pageIndex: pageIndex,
				pageSize: pageSize,
				pltCode:
					this.$store.state.pltCode == ""
						? 0
						: this.$store.state.pltCode,
				macType: this.$store.state.macType,
				ctgCode: ctgCode == "" ? 0 : ctgCode,
			};
			gtCodeLaw(dataJson).then((res) => {
				this.CodeLaw = [];
				if (res.data.code != 0) {
					return;
				}
				this.CodeLaw = res.data.data;
			});
		},
		// 机种
		getCodeCtgApi(code, codName, pageIndex, pageSize, codSymb) {
			let dataJson = {
				macType: Number(this.radio),
			};
			getCodeCtg(dataJson).then((res) => {
				this.CodeCtg = [];
				if (res.data.code != 0) {
					return;
				}
				this.CodeCtg = res.data.data;
			});
		},
		//装置筛选
		PlantChange() {
			this.$store.commit("changePltCode", this.valuePlant);

			if (!this.isLineNo) {
				this.GetLineIndexMacCodeApi();
				return
			}

			if (!this.isSysIntelligenceList) {
				this.GetSysIntelligenceListApi();
				return
			}
			// 更新保存的装置code
			// 更新保存的装置name
			this.plantOptions.forEach((Item) => {
				if (Item.pltCode == this.valuePlant) {
					let valuePlant = Item.pltName;
					this.$store.commit("changePlantName", valuePlant);
				}
			});

			this.getMachineApi("", "", "", 1, 1000);
			this.itemActive = null;

			this.getProcessorApi();

		},
		//机种筛选
		CodeCtgChange() {
			this.$store.commit("changeCtgCode", this.valueCodeCtg);
			this.getMachineApi("", "", "", 1, 1000);
			this.itemActive = null;
		},
		//法规筛选
		CodeLawChange() {
			this.$store.commit("changeLawCode", this.valueCodeLaw);
			this.getMachineApi("", this.ctgVaule, "", 1, 1000);

			this.itemActive = null;
		},
		//点击表格行
		ClickTableRow(row, index) {
			this.itemActive = index;
			this.$emit("ClickTableRow", row);
		},
		// 阅览表格行
		ClickReadTableRow(row, index) {
			this.ReaditemActive = index;
			if (!row) return;
			row.timestamp = new Date().valueOf();
			// this.$emit("ClickReadTableRow", row); 更新选中
			this.$emit("ClickReadTableRow", JSON.parse(JSON.stringify(row)));
		},
		//清空默认筛选
		ClearVaule() {
			this.ctgVaule = "";
			this.valueCodeCtg = "";
			this.valueCodeLaw = "";
			this.$store.commit("changeCtgCode", this.valueCodeCtg);
			this.$store.commit("changeLawCode", this.valueCodeLaw);
			this.$store.commit("changeMacName", "");
			this.$store.commit("changeMacNameb", "");
			this.$store.commit("changeMacCode", "");

			let _dataJson = {
				macCode: 0,
				macName: "",
				pltCode:
					this.$store.state.pltCode == ""
						? 0
						: this.$store.state.pltCode,
				macType: this.$store.state.macType,
				ctgCode: 0,
				impCode: 0,
				lawCode: 0,
				pageIndex: 1,
				pageSize: 9999,
			};
			getMachine(_dataJson).then((res) => {
				this.checkboxSelectedList = [];
				eventBus.$emit("reportformLeftMacSelect", []);
				this.drwMgtData = [];
				this.number = 0;
				if (res.data.code != 0) {
					return;
				}
				this.drwMgtData = res.data.data;
				this.number = res.data.count;
				this.itemActive = 0;
				this.$emit("ClickTableRow", this.drwMgtData[0]);
			});
		},
		ctgVauleSearch() {
			if (!this.$store.state.btn_set_BHView2) {
				return
			}
			this.getMachineApi("", this.ctgVaule, "", 1, 1000);
		},
		//切换机器或者配管 数据刷新
		radioChange(radio) {
			// this.checkboxSelectedList = [];
			eventBus.$emit("reportformLeftMacSelect", []);
			this.$store.commit("changeMacType", radio);
			this.ctgVaule = "";
			this.valueCodeCtg = "";
			this.valueCodeLaw = "";
			this.$store.commit("changeCtgCode", this.valueCodeCtg);
			this.$store.commit("changeLawCode", this.valueCodeLaw);
			this.getMachineApi("", this.ctgVaule, "", 1, 1000);
		},

		changeRadioSelect(e) {
			this.radio = e;
			this.$store.commit("changeMacType", this.radio);
			let dataJson = {
				macCode: 0,
				macName: "",
				pltCode:
					this.$store.state.pltCode == ""
						? 0
						: this.$store.state.pltCode,
				macType: this.$store.state.macType,
				ctgCode:
					this.$store.state.ctgCode == ""
						? 0
						: this.$store.state.ctgCode,
				impCode: 0,
				lawCode:
					this.$store.state.lawCode == ""
						? 0
						: this.$store.state.lawCode,
				pageIndex: 1,
				pageSize: 9999,
			};
			getMachine(dataJson).then((res) => {
				this.drwMgtData = [];
				this.checkboxSelectedList = [];
				eventBus.$emit("reportformLeftMacSelect", []);
				this.number = 0;
				if (res.data.code != 0) {
					return;
				}
				this.drwMgtData = res.data.data;
				this.number = res.data.count;
				if (this.drwMgtData.length == 0) return;
				this.$emit("clearBhTabel");
			});
		},

		handleSelectionChange(e) {
			console.log("handleSelectionChange", e)
			this.checkboxSelectedList = e;
			eventBus.$emit("reportformLeftMacSelect", e);
			// 通知名称和code跳回首页图纸加载対应机器
			if (e.length != 0) {
				this.$store.commit("changeMacName", e[e.length - 1].name);
				this.$store.commit("changeMacCode", e[e.length - 1].macCode);
				this.$store.commit("changeMacNameb", e[e.length - 1].macName);
			}
		},
		/** 默认选择方法 */
		toggleSelection() {
			this.$nextTick(() => {
				// 	//循环表格数据
				// 	for (let i = 0; i < this.queryData.length; i++) {
				// 	//判断是否满足选择条件  selectionStatus=1时默认选中
				// 	if(this.queryData[i].selectionStatus === 1){
				this.$refs.multipleTable.toggleRowSelection([
					{
						row: this.drwMgtData[0],
						selected: true
					}
				])
				// 	}
				// }
			})
		},
		async GetMachineByCodFn() {
			let R = await GetMachineByCod({
				Account: getLocalStorage('userName'),
				PltCode: this.$store.state.pltCode
			})
			console.log(R);
			this.$refs.multipleTable.toggleAllSelection(false)
			this.drwMgtData.forEach((i, v) => {
				R.data.data.forEach((a, b) => {
					if (i.macCode == a.dmg_Code) {
						// 通知名称和code跳回首页图纸加载対应机器
						// 选中当前机器
						this.$refs.multipleTable.toggleRowSelection([
							{
								row: this.drwMgtData[v],
								selected: true
							}
						])
					}
				})
			})
		},
	},
	// 创建前状态(里面是操作)
	beforeCreate() { },
	// 创建完毕状态(里面是操作)
	created() {

		//默认添加装置
		let dataJson = {
			pltCode: 0,
			platName: "",
			pageIndex: 1,
			pageSize: 1000,
		};
		getPlant(dataJson).then((res) => {
			this.plantOptions = [];
			if (res.data.code != 0) {
				this.valuePlant = null;
				this.$store.commit("changePltCode", null);
				return;
			}
			this.plantOptions = res.data.data;
			//  如果有选择过装置 ---添加为记忆选项

			let filterFlg = this.plantOptions.filter(item => item.pltCode == this.$store.state.pltCode);
			if (this.$store.state.pltCode && filterFlg.length > 0) {
				this.valuePlant = this.$store.state.pltCode;
			} else {
				this.valuePlant = this.plantOptions[0].pltCode;
				this.$store.commit("changePltCode", this.valuePlant);
			}

			this.plantOptions.forEach((Item) => {
				if (Item.pltCode == this.valuePlant) {
					let valuePlant = Item.pltName;
					this.$store.commit("changePlantName", valuePlant);
				}
			});
			this.$store.commit("changeCtgCode", '');
			this.$store.commit("changeLawCode", '');
			let dataJson = {
				macCode: 0,
				macName: "",
				pltCode:
					this.$store.state.pltCode == ""
						? 0
						: this.$store.state.pltCode,
				macType: this.$store.state.macType,
				ctgCode: 0,
				// this.$store.state.ctgCode == ""
				// 	? 0
				// 	: this.$store.state.ctgCode,
				impCode: 0,
				lawCode: 0,
				// this.$store.state.lawCode == ""
				// 	? 0
				// 	: this.$store.state.lawCode,
				pageIndex: 1,
				pageSize: 9999,
			};
			getMachine(dataJson).then(async (res) => {
				this.drwMgtData = [];
				this.checkboxSelectedList = [];
				eventBus.$emit("reportformLeftMacSelect", []);
				this.number = 0;
				this.$emit("ClearDataFunction");
				if (res.data.code != 0) {
					return;
				}
				this.drwMgtData = res.data.data;

				// this.drwMgtData.forEach((i, v) => {
				// 	if (i.macName == this.$store.state.macNameb) {
				// 		console.log("checked - checked - checked")
				// 		console.log(i)
				// 		// 通知名称和code跳回首页图纸加载対应机器
				// 		this.$store.commit("changeMacName", i.name);
				// 		this.$store.commit("changeMacCode", i.macCode);
				// 		// 选中当前机器
				// 		this.$refs.multipleTable.toggleRowSelection([
				// 			{
				// 				row: this.drwMgtData[v],
				// 				selected: true
				// 			}
				// 		])
				// 		this.handleSelectionChange([i])
				// 		setTimeout(() => {
				// 			this.$refs.multipleTable.pagingScrollTopLeft(v * 32, 0)
				// 		}, 300);
				// 	}
				// })
				await this.GetMachineByCodFn();
				this.number = res.data.count;
				// this.itemActive = 0;
				if (this.drwMgtData.length == 0) return;
				this.$emit("clearBhTabel");
			});
		});
	},

	// 挂载前状态(里面是操作)
	beforeMount() { },
	// 挂载结束状态(里面是操作)
	mounted() {
		this.tableHeight = $(".machine-number-long").height();
		let _this = this;
		// console.log($(".elx-cell--title")

		$(document).ready(function () {
			$(".elx-cell--title").eq(0).text("");
		});
		eventBus.$on("selectValue", (flg) => {
			this.$refs.multipleTable.toggleAllSelection(flg);
		})

		eventBus.$on("GetMachineByCodFnEmT", () => {
			this.GetMachineByCodFn();
		})
		eventBus.$on("GetMachineByCustomer1", (E) => {
			this.drwMgtData.forEach((i, v) => {
				this.$refs.multipleTable.toggleRowSelection([
					{
						row: this.drwMgtData[v],
						selected: false
					}
				])
				E.forEach((a, b) => {
					if (i.macCode == a.macCode) {
						// 通知名称和code跳回首页图纸加载対应机器
						// 选中当前机器
						this.$refs.multipleTable.toggleRowSelection([
							{
								row: this.drwMgtData[v],
								selected: true
							}
						])
					}
				})
			})
		})
		eventBus.$on("GetMachineByCustomer1_2", (E) => {

			if (E == 'Equal') {
				this.valuePlant = this.plantOptions[0].pltCode;
				this.$store.commit("changePlantName", this.plantOptions[0].pltName);
				// this.PlantChange()
				this.$store.state.pltCode = ""
				this.$store.state.ctgCode = ""
				this.$store.state.lawCode = ""
				this.PlantChange()
				return
			}
			this.valuePlant = ' ';
			this.valueCodeCtg = ' ';
			this.valueCodeLaw = ' ';
			this.ctgVaule = ' ';
			this.$store.commit("changePlantName", ' ');
			this.drwMgtData = E;
			setTimeout(() => {
				this.$refs.multipleTable.toggleAllSelection()
				// this.drwMgtData.forEach((i, v) => {
				// 	this.$refs.multipleTable.toggleRowSelection([
				// 		{
				// 			row: this.drwMgtData[v],
				// 			selected: true
				// 		}
				// 	])
				// })
			}, 100);
		})
	},
	// 更新前状态(里面是操作)
	beforeUpdate() { },
	// 更新完成状态(里面是操作)
	updated() {
		// 使用querySelectorAll选中所有带有.elx-cell--checkbox类的元素
		var elements = document.querySelectorAll('.elx-cell--checkbox');

		// 遍历这些元素  
		elements.forEach(function (element) {
			// 修改每个元素的title属性  
			element.setAttribute('title', '');
		})
	},
	// 销毁前状态(里面是操作)
	beforeDestroy() {
		eventBus.$off("GetMachineByCustomer1_2");
		eventBus.$off("GetMachineByCustomer1");
		eventBus.$off("GetMachineByCodFnEmT");
		eventBus.$off("selectValue");

		eventBus.$off("selectViewValueFun");
		eventBus.$off("triggerLeftTabelClick");
		eventBus.$off("modifyPltCode");
		eventBus.$off("InitTableFirstData");
		eventBus.$off("SelectTableRow");
	},
	// 销毁完成状态(里面是操作)
	destroyed() { },
};
</script>
<style lang="scss" scoped>
.LedtContent {
	width: 100%;
	height: 100%;
	overflow: hidden;
	overflow-y: auto;
	display: flex;
	justify-content: space-between;
	flex-direction: column;
}

.form-view {
	padding: 16px 0px 0px 24px;

	.form-row {
		width: 100%;
		height: 24px;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 12px;

		.seach {
			width: 24px;
			height: 24px;
			border-radius: 4px;
			border: 1px solid #d9d9d9;
			display: flex;
			align-items: center;
			justify-content: center;
			cursor: pointer;
		}

		.form-row-label {
			color: rgba(0, 0, 0, 0.85);
			//   font-weight: 500;
		}

		.form-row-right-content {
			width: 197px;

			.form-ipt {
				width: 100%;
				height: 24px;

				::v-deep .el-input__inner {
					height: 24px;
					background: #fff;
				}

				::v-deep .el-input__icon {
					line-height: 24px;
				}
			}

			.ClearBtn {
				min-width: 66px;
				height: 24px;
				border-radius: 4px;
				display: flex;
				justify-content: center;
				align-items: center;
				// border: 1px solid #eaeaeb;
				// background: #106ebe;
				// color: #fff;
				float: right;
			}
		}
	}

	.form-checkbox {
		padding: 0 0 12px 44px;
	}
}

.fourth-tabel-style {
	height: calc(100% - 138px) !important;
}

.machine-number-long {
	height: calc(100% - 282px) !important;
}

.machine-number {
	width: calc(100% - 24px);
	// height: calc(100% - 282px);
	height: calc(100% - 424px);
	border: 1px solid #c3c3c3;
	margin-left: 24px;

	// border-right: 0 none;
	.title {
		width: 100%;
		height: 32px;
		font-size: 14px;
		color: rgba(0, 0, 0, 0.85);
		background: #e9e9e9;
		display: flex;
		align-items: center;
		justify-content: center;
		border-bottom: 1px solid rgba(195, 195, 195, 0.3);
	}

	.machine-number-body {
		width: 100%;
		height: calc(100% - 32px);
		overflow: hidden;
		overflow-y: auto;

		.Item {
			display: flex;
			align-items: center;
			justify-content: flex-start;
			width: 100%;
			height: 24px;
			cursor: pointer;
			border-bottom: 1px solid rgba(195, 195, 195, 0.3);
			background: #ffffff;
			transition: 0.5s;

			.ItemID {
				width: 31px;
				height: 24px;
				border-right: 1px solid rgba(195, 195, 195, 0.3);
				display: flex;
				align-items: center;
				justify-content: center;
				color: rgba(0, 0, 0, 0.85);
			}

			.ItemName {
				padding-left: 24px;
				height: 100%;
				color: rgba(0, 0, 0, 0.65);
				display: flex;
				align-items: center;
			}
		}

		.Item:hover {
			background: rgb(255, 241, 240);
		}

		.ItemActive {
			background: rgb(255, 241, 240);
		}
	}
}

.bh-style {
	width: calc(100% - 24px);
	// height: 352px;
	border: 1px solid #c3c3c3;
	margin-left: 24px;

	// border-right: 0 none;
	.title {
		width: 100%;
		height: 32px;
		font-size: 14px;
		color: rgba(0, 0, 0, 0.85);
		background: #e9e9e9;
		display: flex;
		align-items: center;
		justify-content: center;
		border-bottom: 1px solid rgba(195, 195, 195, 0.3);
	}

	.bh-style-body {
		width: 100%;
		height: calc(100% - 32px);

		.Item {
			width: 100%;
			display: flex;
			height: 24px;
			justify-content: flex-start;
			align-items: center;
			color: rgba(0, 0, 0, 0.85);
			padding-left: 12px;
			border-bottom: 1px solid rgba(195, 195, 195, 0.3);
			background: #ffffff;
		}

		.item-label {
			width: 70px;
			height: 100%;
			display: flex;
			align-items: center;
		}

		.item-bh-msg {
			line-height: 24px;
			width: calc(100% - 70px);
			height: 100%;

			.right-text {
				float: right;
				margin-right: 12px;
			}
		}
	}
}

.bh-footer {
	// width: 100%;
	height: 38px;
	background: #e9e9e9;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-left: 24px;

	.bh-footer-msg {
		// width: 132px;
		height: 24px;
		line-height: 24px;
		padding-left: 8px;
		border-radius: 4px;
		margin: 0 4px;
	}
}

::v-deep .el-radio {
	margin-right: 24px;
}

::v-deep .el-radio:last-child {
	margin-right: 0;
}

::v-deep .elx-cell--title {
	margin: 0 auto;
}

::v-deep .elx-body--row:hover {
	background-color: rgb(255, 241, 240) !important;
}

::v-deep .row--current {
	background-color: rgb(255, 241, 240) !important;
}

::v-deep .col--gutter {
	background: rgb(233, 233, 233);
}

.mask::after {
	content: '';
	display: block;
	width: 100%;
	height: 100%;
	cursor: not-allowed;
	position: absolute;
	top: 0;
	left: 0;
	z-index: 50;
}
</style>
